<template>
  <div>
    <el-form ref="form" :model="form" label-width="120px">
      <el-form-item label="ھەققىدە بەتنىڭ ئادىرىسى" label-width="200px">
        <el-input v-model="form.aboutPageUrl" size="small" style="max-width: 400px;"></el-input>
      </el-form-item>
      <el-form-item label="ئەپ چۈشۈرۈش ئاىدىرىسى" label-width="200px" required prop="downloadUrl">
        <el-input v-model="form.downloadUrl" size="small" style="max-width: 600px;"></el-input>
      </el-form-item>
      <el-form-item label="ھەمبەھىرلەش كارتىسىدىكى چاچما كود ئادىرىسى" label-width="200px" prop="shareQrCoderUrl" required>
        <el-input v-model="form.shareQrCoderUrl" size="small" style="max-width: 600px;"></el-input>
        <br>
        <img :src="form.shareQrCoderUrl" v-if="form.shareQrCoderUrl" alt="">
      </el-form-item>
      <el-form-item label="ئەپ نەشرى " label-width="200px" prop="version" required>
        <el-input v-model="form.version" size="small" style="max-width: 200px;" required></el-input>
      </el-form-item>
    </el-form>
    <el-row style="margin:24px 200px 0">
      <el-button type="primary" @click="save">ساقلاش</el-button>
    </el-row>
  </div>
</template>

<script>
import { getAdConfig, setAdConfig } from '@/api/kino';
export default {
  name: 'BaseInfo',
  components: {},
  data() {
    return {
      form: {}
    };
  },
  created() {
    getAdConfig({
      setting_name: 'appBaseConfig'
    }).then(res => {
      console.log(res);
      this.form = res;
    })
  },
  methods: {
    save() {
      this.$refs['form'].validate(async (valid) => {
        if (valid) {
          console.log(this.form);
          setAdConfig(
            { setting_name: 'appBaseConfig', config: this.form }
          ).then(res => {
            this.$message.success('ساقلاندى');
            console.log(res);
          })
        }
      })
    }
  },
};
</script>

<style scoped lang="scss">
</style>
